//停车记录 - 静态 路由
import { http } from "@/utils/http";
import { baseUrlApi } from "./utils";
import { ResultTable } from "./result/result_table";

const basePath = "system/role";

type Result = {
  success: boolean;
  data?: Array<any>;
  message?: string;
};

/** 系统管理-用户管理-获取所有角色列表 */
export const getAllRoleList = () => {
  return http.request<Result>("get", baseUrlApi(basePath + "/all"));
};

//获取自己的角色
export const getRoleIds = (data?: object) => {
  return http.request<Result>("post", baseUrlApi(basePath + "/my"), {
    data
  });
};

//更新角色
export const updateUserRole = (data?: object) => {
  return http.request<Result>("post", baseUrlApi(basePath + "/update_user"), {
    data
  });
};

//角色列表
export const getRoleList = (data?: object) => {
  return http.request<Result>("post", baseUrlApi(basePath), {
    data
  });
};

//更新角色
export const updateRole = (data?: object) => {
  return http.request<Result>("post", baseUrlApi(basePath + "/update"), {
    data
  });
};

//新增角色
export const addRole = (data?: object) => {
  return http.request<Result>("post", baseUrlApi(basePath + "/add"), {
    data
  });
};

//修改状态
export const updateRoleStatus = (data?: object) => {
  return http.request<Result>("post", baseUrlApi(basePath + "/update_status"), {
    data
  });
};

//删除
export const delRole = (data?: object) => {
  return http.request<Result>("post", baseUrlApi(basePath + "/delete"), {
    data
  });
};

//删除
export const updateRoleGroup = (data?: object) => {
  return http.request<Result>("post", baseUrlApi(basePath + "/update_group"), {
    data
  });
};
